a=[[ 0,-2,-7, 0],
   [ 9, 2,-6, 2],
   [-4, 1,-1, 1],
   [-1, 8, 0,-2]]
ROW=len(a)
COL=len(a[0])
sums=[]
poses=[]
for x in range(ROW):
    for y in range(COL):
        for bx in range(ROW-x+1):
            for by in range(COL-y+1):
                SUM=0
                for x1 in range(bx):
                    for y1 in range(by):
                        SUM+=a[x+x1][y+y1]
                sums.append(SUM)
                poses.append((x,y,x+bx,y+by))
print(max(sums))
pos=poses[sums.index(max(sums))]
for i in range(pos[0],pos[2]):
    for j in range(pos[1],pos[3]):
        print(a[i][j],end=' ')
    print("")